package grapid.database;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.TreeMap;

/**
 * 默认数据库操作实例类
 * 
 * @author grapid
 * @version 2.0
 * 
 */
public class GBaseDAOImpl extends GBaseDAO<TreeMap<String, String>> {

	protected TreeMap<String, String> makeModule(ResultSet rs, Integer index) throws SQLException {
		return makeModule(rs);
	}

	/**
	 * 默认组建module类
	 * 
	 * @param rs
	 *            ResultSet
	 * @return 返回module
	 */
	private TreeMap<String, String> makeModule(ResultSet rs) {
		TreeMap<String, String> module = new TreeMap<String, String>();
		try {
			for (int i = 1, j = rs.getMetaData().getColumnCount() + 1; i < j; i++) {
				module.put(rs.getMetaData().getColumnName(i), rs.getString(i));
			}
		} catch (SQLException e) {
		}
		return module;
	}
}
